var initGears = function () 
{
    var db;

    if (window.google && google.gears) 
    {
        try 
        {
            db = google.gears.factory.create('beta.database');

            if (db) 
            {
                db.open('microblog');                
                return db;    
            }                

        } 
        catch (ex) 
        {
            alert('Could not create database: ' + ex.message);
            setError('Could not create database: ' + ex.message);
        }
    }
    else
    {
        //location.href = "http://gears.google.com/?action=install&message=<your welcome message>" + "&return=<your website url>";
    }
};

var onLoad = function()
{
    var db;

    db = initGears();
    $('#microblogBox').microblogBox({db: db});
};

$(document).ready(onLoad);
